/**
 * Created by djh on 2016/11/8.
 * 合同 js
 *
 */
define(function(require,exports){
    var common = require("common");
    var template = require("template");
    exports.init = function() {
        function printtable(printpage){


            var headstr='<head><link rel="stylesheet" type="text/css" href="/res/mpe/scss/css/member/order-min.css?v=9423da5359" /> ' +
                '</head>';
            var footstr="<body></body>";

            var newstr=$("#"+printpage).prop("outerHTML");

            var printPage = $("<div id='printPage' style='font-size:14px;left:0px;top:0px;z-index:9999;background:#fff;width:100%;height;100%;position:absolute;'></div>");
            printPage.append($(headstr + newstr + footstr));
            $(document.body).after(printPage);
            $(document.body).css('display','none');

            window.print();

            $('#printPage').remove();
            $(document.body).css('display','block');

            return false;
        }
        $("#print").on("click",function(){
            printtable('J_ListTable');
        });
        require("page");
        common.leftNav({dl:1,dd:1});
        //合同 查看弹窗
        $(".contract").on("click","[data-act='look']",function(){
            var id = $(this).attr("data-id");
            var pay_way = $(this).data("pay_way");

            common.ajaxHandle({
                url:"/member/contract/details",
                data:{id:id},
                callback:function(item){
                    data = item.data;
                    data["pay_way"]=pay_way;
                    var temp = template("lookTemp",data);
                    layer.open({
                        type:1,
                        title:"合同详情",
                        area:"600px",
                        content:temp

                    })
                }
            });

        });

    }
});
